/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.cardarus.operatingsystem.domain;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Javier Snaider
 */
@Entity
@Table(name = "USERROL")
@NamedQueries({
    @NamedQuery(name = "Userrol.findAll", query = "SELECT u FROM Userrol u"),
    @NamedQuery(name = "Userrol.findById", query = "SELECT u FROM Userrol u WHERE u.id = :id"),
    @NamedQuery(name = "Userrol.findByUsername", query = "SELECT u FROM Userrol u WHERE u.username = :username"),
    @NamedQuery(name = "Userrol.findByRol", query = "SELECT u FROM Userrol u WHERE u.rol = :rol")})
public class Userrol implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer id;
    @Column(name = "USERNAME")
    private String username;
    @Column(name = "ROL")
    private String rol;

    public Userrol() {
    }

    public Userrol(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getRol() {
        return rol;
    }

    public void setRol(String rol) {
        this.rol = rol;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Userrol)) {
            return false;
        }
        Userrol other = (Userrol) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.cardarus.operatingsystem.domain.Userrol[id=" + id + "]";
    }

}
